{% extends "base.html" %}

{% block subtitle %}
  Moderator Tools
{% endblock subtitle %}

{% block content %}
  <div ng-controller="Moderator">
    <div class="oppia-content">
      <h3>Email a user</h3>
      <div class="oppia-gallery-frame">
        <form ng-submit="submitUserEmailRequest(username)">
          <div>
            Username:
            <input type="text" ng-model="username">
          </div>
          <button type="submit">Get Email</button>
        </form>
      </div>
      <div ng-show="lastSubmittedUsername && !userEmail">
        <strong>No such user</strong>
      </div>
      <div>
        <[userEmail]>
      </div>
    </div>

    <div class="oppia-content">
      <h3>Recent Commits (all non-private explorations)</h3>
      <div when-scrolled-to-bottom="loadMoreCommits()" ng-show="allCommits.length">
        <table class="oppia-padded-table">
          <tr>
            <th>Timestamp</th>
            <th>Exploration</th>
            <th>Category</th>
            <th>Username</th>
            <th>Commit message</th>
            <th>Community-owned?</th>
          </tr>
          <tr ng-repeat="commit in allCommits track by $index">
            <td><[getHumanReadableDate(commit.last_updated)]></td>
            <td>
              <a ng-href="<[getExplorationCreateUrl(commit.exploration_id)]>">
                <[explorationData[commit.exploration_id].title]>
              </a>
            </td>
            <td>
              <[explorationData[commit.exploration_id].category]>
            </td>
            <td><[commit.username]></td>
            <td><[commit.commit_message]></td>
            <td><[commit.post_commit_community_owned]></td>
          </tr>
        </table>
      </div>
    </div>
  </div>
{% endblock %}

{% block footer_js %}
  {{ super() }}
  <script>
    {{ include_js_file('/moderator/Moderator.js') }}
  </script>
{% endblock footer_js %}
